package com.gitee.wsl.common.ui.ext

import androidx.compose.ui.unit.IntOffset
import androidx.compose.ui.unit.IntRect
import androidx.compose.ui.unit.LayoutDirection


fun IntRect.topStart(layoutDirection: LayoutDirection): IntOffset = when (layoutDirection) {
    LayoutDirection.Ltr -> topLeft
    LayoutDirection.Rtl -> topRight
}

fun IntRect.topEnd(layoutDirection: LayoutDirection): IntOffset = when (layoutDirection) {
    LayoutDirection.Ltr -> topRight
    LayoutDirection.Rtl -> topLeft
}

fun IntRect.centerStart(layoutDirection: LayoutDirection): IntOffset = when (layoutDirection) {
    LayoutDirection.Ltr -> centerLeft
    LayoutDirection.Rtl -> centerRight
}

fun IntRect.centerEnd(layoutDirection: LayoutDirection): IntOffset = when (layoutDirection) {
    LayoutDirection.Ltr -> centerRight
    LayoutDirection.Rtl -> centerLeft
}

fun IntRect.bottomStart(layoutDirection: LayoutDirection): IntOffset = when (layoutDirection) {
    LayoutDirection.Ltr -> bottomLeft
    LayoutDirection.Rtl -> bottomRight
}

fun IntRect.bottomEnd(layoutDirection: LayoutDirection): IntOffset = when (layoutDirection) {
    LayoutDirection.Ltr -> bottomRight
    LayoutDirection.Rtl -> bottomLeft
}
